package Thread_;

public class Thread_ {
    public static void main(String[] args) {
        new Dog().start();
        Thread thread = new Thread(new Cat());
        thread.start();
        System.out.println(Thread.currentThread().getName());
        for(int i = 0;; i++){
            System.out.println("你愁啥______________");
        }
    }
}

class Dog extends Thread{
    int count = 0;
    @Override
    public void run() {
        while (true){
            System.out.println("汪汪汪 " + (++count) + " " + Thread.currentThread().getName());
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if(count == 10){
                break;
            }
        }
    }
}

class Cat implements Runnable{
    int count = 0;
    @Override
    public void run() {
        while (true){
            System.out.println("喵喵喵 " + (++count) + " " + Thread.currentThread().getName());
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if(count == 10){
                break;
            }
        }
    }
}